class CreateParticipants < ActiveRecord::Migration
  def self.up
    create_table :participants, :primary_key => "participant_id" do |table|
      table.column :event_id, :integer, :null => false # FK events
      table.column :team_id, :integer, :null => false
      table.column :pair_id, :integer, :null => false
      table.column :player_id, :integer, :null => false
      table.column :num, :integer
      table.column :place, :integer
      table.column :rp, :integer
      table.column :mb, :integer
      table.column :pb, :integer                  
    end
#    execute "
#      ALTER TABLE participants ADD FOREIGN KEY (event_id) REFERENCES events (event_id);
#      ALTER TABLE participants ADD FOREIGN KEY (team_id) REFERENCES teams (team_id);
#      ALTER TABLE participants ADD FOREIGN KEY (pair_id) REFERENCES pairs (pair_id);
#      ALTER TABLE participants ADD FOREIGN KEY (player_id) REFERENCES players (player_id);
#    "    
  end

  def self.down
    drop_table :participants
  end
end
